package com.yswy.backstage.enums;


import org.apache.commons.lang3.StringUtils;

/**
 * @Copyright 成都可迅捷科技有限公司
 * @ClassName HuaweiObsArea
 * @Description obs桶信息
 * @Author baoruizhe
 * @Date 2020/9/22 10:44
 * @Version 1.0
 **/
public enum HuaweiObsArea {

    GUANGZHOU("广州","cn-south-1","obs.cn-south-1.myhuaweicloud.com","weigou-files-south1"),
    SHANGHAI1("上海一","cn-east-3","obs.cn-east-3.myhuaweicloud.com","weigou-files-east3"),
    BEIJING4("北京四","cn-north-4","obs.cn-north-4.myhuaweicloud.com","weigou-files");


    HuaweiObsArea(String areaName, String area, String endpoint, String bucketName) {
        this.areaName = areaName;
        this.area = area;
        this.endpoint = endpoint;
        this.bucketName = bucketName;
    }

    private String areaName;
    private String area;
    private String endpoint;
    private String bucketName;


    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public String getEndpoint() {
        return endpoint;
    }

    public void setEndpoint(String endpoint) {
        this.endpoint = endpoint;
    }

    public String getBucketName() {
        return bucketName;
    }

    public void setBucketName(String bucketName) {
        this.bucketName = bucketName;
    }


    public static HuaweiObsArea getByArea(String area) {
        if (StringUtils.isEmpty(area)) {
            return null;
        }
        HuaweiObsArea[] values = HuaweiObsArea.values();
        for (HuaweiObsArea value : values) {
            if (area.equals(value.getArea())) {
                return value;
            }
        }
        return null;
    }
    public static HuaweiObsArea getByBucketName(String bucketName) {
        if (StringUtils.isEmpty(bucketName)) {
            return null;
        }
        HuaweiObsArea[] values = HuaweiObsArea.values();
        for (HuaweiObsArea value : values) {
            if (bucketName.equals(value.getBucketName())) {
                return value;
            }
        }
        return null;
    }


}
